/* 
 * File:   Instance.h
 * Author: brady
 *
 * Created on September 6, 2011, 5:50 PM
 */

#ifndef INSTANCE_H
#define	INSTANCE_H

#include <shapes/Shape.h>
#include <core/TransformMatrix.h>

class Instance : public Shape{
public:
    Instance();
    Instance(Shape* shape);
    Instance(const Instance& orig);
    virtual ~Instance();

    void rotate(double degrees, int axis);
    void scale(double sx, double sy, double sz);
    void translate(double dx, double dy, double dz);
    void finalize(); //Does final calculations, such as computing inverse of TMatrix
                     //and building boundingBox
    void setShape(Shape* shape){this->shape = shape;}
    bool testIntersect(IntersectionParams& ip, IntersectionResult& ir);

private:
    Shape* shape;
    TransformMatrix TMatrix;
    TransformMatrix TMatrix_inv;
    void buildBoundingBox();

};

#endif	/* INSTANCE_H */

